package com.aaa.observermode;

import java.rmi.Remote;
import java.util.ArrayList;

/**
 * @author C-Q
 * @version 1.1.0
 * @Description: TODO
 * @date 2022/11/9
 */
public class AAAPublic implements IPublic{
    private String msg;
    private ArrayList<UserInterface> list=new ArrayList<UserInterface>();
    @Override
    public void guanzhu(UserInterface userInterface) {
        list.add(userInterface);
    }

    @Override
    public void quxiao(UserInterface userInterface) {
        list.remove(userInterface);
    }

    @Override
    public void setMsg(String msg) {
        this.msg=msg;
    }

    @Override
    public void qunfa() {
        for (UserInterface userInterface:list) {
            userInterface.getMsg(msg);
        }
    }
}
